<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets">
      
<h:head>
	<title>Search Basic Products</title>
</h:head>
<h:body>

<p:panel>
		<h:link outcome="index" value="Home" /> <br /> 
		<h:link outcome="indexPackages" value="Packages section" /> <br /> 
        <h:link outcome="indexBasicProduct" value="Basic Products section" /> <br /> 
       	<h:link outcome = "createPackage" value = "Go To The Package!"/>
 </p:panel>
 
	<h:form id="form">
	
     <p:dataTable var="excursion" value="#{excursionSearch.excursions}" rowKey="#{excursion.id}" 
    			 paginator="true"  
             
                filteredValue="#{excursionSearch.filtered}" 
                id="excursionsTable"
                emptyMessage="There are NO Excursions"
                paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
				rowsPerPageTemplate="5,10,15"
				
				cellSeparator="true"
				resizableColumns="true">  
  
      	<p:column headerText="ID" sortBy="id" filterBy="id" id="id">  
            #{excursion.id}
        </p:column>   

      	<p:column headerText="Type" sortBy="type" filterBy="type" id="type">  
            #{excursion.type}
        </p:column> 
        
        <p:column headerText="Description" sortBy="description" filterBy="description" id="description">  
            #{excursion.description}
        </p:column>  

      	<p:column headerText="Date" sortBy="date" filterBy="date" id="date">  
            #{excursion.date}
        </p:column>   

      	<p:column headerText="Start Time" sortBy="startTime" filterBy="startTime" id="startTime">  
            #{excursion.startTime}
        </p:column>

      	<p:column headerText="End Time" sortBy="endTime" filterBy="endTime" id="endTime">  
            #{excursion.endTime}
        </p:column>
        
        <p:column headerText="Price" sortBy="price" filterBy="price" id="price">  
            #{excursion.price}
        </p:column>


   		<p:column style="width:32px">
   			    <f:facet name="header">
   					<input type='button' value="*" readonly="readonly" title='View Details!' />
   				</f:facet >	 
   			  
             <p:commandButton update=":dlgForm:excDetGrid" oncomplete="excDialog.show()"  
                     image="ui-icon ui-icon-search" style="width:32px"
                     > 
                 <f:setPropertyActionListener value="#{excursion}"  
                     target="#{excursionSearch.currentExcursion}" />  
                    
             </p:commandButton> 
         </p:column> 
    	 
                  <p:column style="width:32px">
                             <f:facet name="header">
   					<input type='button' value="*" readonly="readonly" title='Delete Product!' />
   				</f:facet >
                      <p:commandButton id="excDelete"  
             update=":form:excursionsTable" icon="ui-icon-trash"
              ajax="false" onmouseover="Delete" style="width:32px"
              action="#{excursionSearch.deleteExcursion()}">
                     <f:setPropertyActionListener value="#{excursion}"  
                     target="#{excursionSearch.currentExcursion}" />  
                     </p:commandButton>
         </p:column>  
                 <p:column style="width:32px">
                 <f:facet name="header">
   					<input type='button' value="*" readonly="readonly" title='Add Product To The Package!' />
   				</f:facet >
                      <p:commandButton style="width:32px" 
                      	onmouseover="Add To Package!" icon="ui-icon-disk" 
       		        		 action="#{excursionSearch.addToPack()}"  ajax="false" update=":form:excursionsTable">
                    <f:setPropertyActionListener value="#{excursion}"  
                     target="#{excursionSearch.currentExcursion}" />  
                     </p:commandButton>
                  </p:column>
                  
                             <p:column style="width:32px">
                 <f:facet name="header">
   					<input type='button' value="*" readonly="readonly" title='Add to Modify!' />
   				</f:facet >	  
 			  <p:commandButton style="width:32px"  icon="ui-icon-gear"
       		        		 action="#{excursionSearch.passToModified()}" ajax="false"
       		        		 type="submit" process="@this"
       		        		 oncomplete="modDialog.show()"
       		        		 update=":pan:modGrid" >
               <f:setPropertyActionListener value="#{excursion}"  
                     target="#{excursionSearch.currentExcursion}" 
                     />  
              </p:commandButton>
              
       	</p:column> 
                  
                  
        
        
   </p:dataTable>
 </h:form>
   
   
   <p:dialog id="excDialog" header="Details" widgetVar="excDialog" resizable="true"  
              width="600" height="340" dynamic="true" showEffect="exlpode" hideEffect="explode" closeOnEscape="true">  
        	 
          <h:form id="dlgForm">
         <h:panelGrid id="excDetGrid" columns="2" >
         
         	          
					<h:outputLabel>Available*:</h:outputLabel>
					<p:selectBooleanCheckbox value="#{excursionSearch.currentExcursion.available}" disabled="true" />
					
				
					<h:outputLabel>Disponibility*:</h:outputLabel>
					<h:outputText value="#{excursionSearch.currentExcursion.disponibility}"/>
			
					<h:outputLabel>Price*:</h:outputLabel>
					<h:outputText value="#{excursionSearch.currentExcursion.price}"/>
			
					<h:outputLabel>Type*:</h:outputLabel>
					<h:outputText value="#{excursionSearch.currentExcursion.type}" />
			
					<h:outputLabel>Description*:</h:outputLabel>
					<h:outputText value="#{excursionSearch.currentExcursion.description}" rows="6" cols="33" />
			
					<h:outputLabel >Date*:</h:outputLabel>
					<p:calendar value="#{excursionSearch.currentExcursion.date}"  disabled="true"/>
		
					<h:outputLabel>Start Time*:</h:outputLabel>
					<p:calendar value="#{excursionSearch.currentExcursion.startTime}"  pattern="HH:mm" timeOnly="true" disabled="true"/>
		
					<h:outputLabel>End Time*:</h:outputLabel>
					<p:calendar value="#{excursionSearch.currentExcursion.endTime}"  pattern="HH:mm" timeOnly="true" disabled="true"/>
           

        </h:panelGrid> 
        
        </h:form>
        
		
        	
    </p:dialog>
    <p:panel id="pan" header="Modify!">
		<h:form>
			<h:panelGrid columns="3" id="redGrid">
			
						<h:outputLabel for="available">Available*:</h:outputLabel>
					<p:selectBooleanCheckbox id="available"  value="#{excursionSearch.modifiedExcursion.available}" />
					<h:message for="available"/>
				
					<h:outputLabel for="disponibility">Disponibility*:</h:outputLabel>
					<p:inputMask id="disponibility" value="#{excursionSearch.modifiedExcursion.disponibility}" />
					<h:message for="disponibility" />
			
					<h:outputLabel for="price">Price*:</h:outputLabel>
					<p:inputMask id="price" value="#{excursionSearch.modifiedExcursion.price}" />
					<h:message for="price" />
			
					<h:outputLabel for="type">Type*:</h:outputLabel>
					<p:inputMask id="type" value="#{excursionSearch.modifiedExcursion.type}" />
					<h:message for="type" />
			
					<h:outputLabel for="description">Description*:</h:outputLabel>
					<p:inputTextarea id="description" value="#{excursionSearch.modifiedExcursion.description}" rows="6" cols="33" />
					<h:message for="description" />
			
					<h:outputLabel for="date">Date*:</h:outputLabel>
					<p:calendar value="#{excursionSearch.modifiedExcursion.date}"  id="date"/>
					<h:message for="date" />
		
					<h:outputLabel for="startTime">Start Time*:</h:outputLabel>
					<p:calendar id="startTime" value="#{excursionSearch.modifiedExcursion.startTime}"  pattern="HH:mm" timeOnly="true" />
					<h:message for="startTime" />
		
					<h:outputLabel for="endTime">End Time*:</h:outputLabel>
					<p:calendar id="endTime" value="#{excursionSearch.modifiedExcursion.endTime}"  pattern="HH:mm" timeOnly="true" />
					<h:message for="endTime" />	


				</h:panelGrid>
    	    <p:commandButton value="Save" icon="ui-icon-disk" ajax="false"  action="#{excursionSearch.modifyExcursion()}"  type= "submit"   />
  		</h:form>
	</p:panel>
    
	 
  
</h:body>
</html>